﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace PedesTrainProject.Grid
{
    [Serializable()]
    public class Light : Element, ISerializable
    {
        protected bool red;
        protected bool green;
        protected List<int> intervals= new List<int>();

        public List<int> Intervals
        {
            get { return intervals; }
            set { intervals = value; }
        }

        public Light()
        {
        }

        public Light(List<int> _intervals)
        {
            intervals = _intervals;
        }

        protected virtual void change()
        {

        }

        #region Serialize
        public Light (SerializationInfo info, StreamingContext ctxt)
        {
            this.red = (bool)info.GetValue("Red", typeof(bool));
            this.green = (bool)info.GetValue("Green", typeof(bool));
            this.intervals = (List<int>)info.GetValue("Intervals", typeof(List<int>));
            this.name = (string)info.GetValue("Name", typeof(string));
            this.skin = (string)info.GetValue("Skin", typeof(string));
        }

        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("Red", this.red);
            info.AddValue("Green", this.green);
            info.AddValue("Intervals", this.intervals);
            info.AddValue("Name", this.name);
            info.AddValue("Skin", this.skin);
        }
        #endregion
    }
}
